import sys
sys.path.append('/Users/cclarke/pytic')
import unittest
import TSCalendar as tscal
from datetime import datetime

class ParseDateTestCase(unittest.TestCase):
      def testDates(self):
         dateStr = {"2007-01-03":datetime(2007,1,3),
                "2007-01":datetime(2007,1,1),
                "2007/12/03":datetime(2007,12,3)
                }
         
         for k,v in dateStr.iteritems():
                dd=tscal.date_parse(k)
                print dd
                self.failUnless(dd==v)
                
      def testQuarters(self):
          qdates= {"2007-Q1":datetime(2007,1,1),
                   "2004-Q4":datetime(2004,10,1),
                    "2004-Q3":datetime(2004,7,1),
                   "1920-Q2":datetime(1920,4,1)}
          
          
          #dd=tscal.date_parse("2007-Q1")
          #print dd
          for k,v in qdates.iteritems():
                dd=tscal.date_parse(k)
                print dd
                self.failUnless(dd==v)

if __name__ == '__main__':
   unittest.main()  